from utils.km_controller import KMController
from utils.state_manager import StateManager
from utils.vision_processor import VisionProcess
from config.screen_coordinates import STORE


class StoreManager:
    """游戏商店管理器"""
    def __init__(self, state_manager: StateManager,mouse_controller: KMController,
                 vision_processor: VisionProcess):
        self.state_manager = state_manager
        self.km = mouse_controller
        self.vision = vision_processor

    def shop_close(self):
        if self.vision.get_ocr_results('升级物品', *STORE.store_status_search_area):
            self.km.move_and_click(*STORE.store_toggle_coordinate)
        return
    def shop_open(self):
        if not self.vision.get_ocr_results('升级物品', *STORE.store_status_search_area):
            self.km.move_and_click(*STORE.store_toggle_coordinate)
        return

